﻿using System.Windows.Data;
using System.Windows.Markup;

namespace SteamGroupPlayers.Utilities.Converters
{
    public class IsNullToBoolConverter : MarkupExtension, IValueConverter
    {
        #region Fields
        private static IsNullToBoolConverter _instance;
        #endregion

        #region Methods
        public override object ProvideValue(System.IServiceProvider serviceProvider)
        {
            return _instance ?? (_instance = new IsNullToBoolConverter());
        }

        public object Convert(object value, System.Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            return value == null;
        }

        public object ConvertBack(object value, System.Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            return value == null;
        }
        #endregion
    }
}